#include <iostream>
#include <vector>
using namespace std;


//https://leetcode.cn/problems/letter-combinations-of-a-phone-number/submissions/629869784/
string str[10] = { "","","abc","def","ghi","jkl","mno","pqrs","tuv","wxyz" };
void Combine(string digits, int level, string combinestr, vector<string>& v) {
    if (level == digits.size()) {
        v.push_back(combinestr);
        return;
    }
    int num = digits[level]-'0';
    string s = str[num];
    for (int i = 0; i < s.size(); i++) {
        Combine(digits, level + 1, combinestr + s[i], v);
    }
}
vector<string> letterCombinations(string digits) {
    vector<string> v;
    if (digits.empty()) {
        return v;
    }
    Combine(digits, 0, "", v);
    return v;
}
int main() {
    string s = "23";
    letterCombinations(s);
	return 0;
}